import {defineConfig} from 'vite'
import vue from '@vitejs/plugin-vue'
import path from "path";
import {createSvgIconsPlugin} from "vite-plugin-svg-icons";
export default defineConfig({
  base:'/online',
  plugins: [
    vue(),
    createSvgIconsPlugin({
      // 指定需要缓存的图标文件夹
      iconDirs: [path.resolve(process.cwd(), 'src/assets/icons/svg')],
      // 指定symbolId格式
      symbolId: 'icon-[dir]-[name]',
    })
  ],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  server: {
    host: '0.0.0.0',
    port: 5173,
    open: true,
    proxy: {
      '/api': {
      // target: 'http://1.94.125.59:80/api',
        target: 'http://127.0.0.1:8080',
        //target: 'http://1.94.125.59:80/api',
        //target: 'http://127.0.0.1:8080',
        //target: 'http://47.108.158.23:19011',
        changeOrigin: true,
        ws: true,
        rewrite: (path) => path.replace(new RegExp('^' + '/api'), '')
      }
    },
  },
})
